function checkAccount()
{
    //0. 获取输入框
    var username = document.getElementById("username").value;

    //1. 创建ajax对象
    var ajax = getAjax();

    //2. 创建请求
    ajax.open("get","/ajax/checkAccount?username="+username,true)

    //4. 获取状态
    ajax.onreadystatechange = function()
    {
        if (ajax.readyState==4 && ajax.status==200)
        {
            var resposeText = ajax.responseText;
            document.getElementById("msg").innerHTML = resposeText;
        }
    }

    //3. 发送请求
    ajax.send();

}

function getAjax()
{
    var ajax = null;
    try
    {
        ajax = new XMLHttpRequest();
    }catch (e){
        ajax = new ActiveXObject("Microsoft.XMLHTTP");
    }

    return ajax;
}